<?php
global $base_url,$user;
$price = round($node->sell_price);
if($price=='0'){
	$cls='highlight_freeproduct';
}
$tid= get_tid_from_node($node->nid);
if($tid != ""){
		$term_obj = uc_catalog_image_load($tid);
	    $img_path = $base_url.'/'.$term_obj->filepath;
	}
?>
<div class="select_cart_div_content <?php print $cls?>">
 <table>
  <tbody>
   <tr><td class="cat_product">
    <span class="catalog-grid-image">
     <img height="51" width="55" class="imagecache imagecache-product_list" src="<?php echo $img_path;?>" />
    </span>
    <p><span class="catalog-grid-title blue"><?php echo $node->title;?></span>
	<?php if($price=='0'){?><img src="<?php echo $base_url."/".path_to_theme()."/images/free_btn.png";?>" class="free_prdt" /><?php }?>
	</p>
    <p><span class="catalog-grid-ref"><?php echo $node->field_tag_line[0]['value'];?></span></p>
    <span class="red"><span class="uc-price">Rs <?php echo round($node->sell_price);?></span>
 </span>
<?php 
 if (module_exists('uc_cart') && variable_get('uc_catalog_grid_display_add_to_cart', TRUE) && ($price !='0')) {
      if (variable_get('uc_catalog_grid_display_attributes', TRUE)) {
        echo $product_table .= theme('uc_product_add_to_cart', $node);
      }
      else {
        echo $product_table .= drupal_get_form('uc_catalog_buy_it_now_form_'. $node->nid, $node);
      }
    }
  $output = user_subscribed_product($user->uid,$node->nid);
  if($price =='0' && empty($output)){
	  $src = $base_url.'/'.path_to_theme().'/images/subscribe_img.gif';
	  $img = "<img src='".$src."'/>";
	  $path = $base_url.'/free/subscribe/'.$node->nid;
	  print "<div class='add-to-cart'>";?>
	<a href="<?php echo $path;?>"><?php echo $img;?></a>
	<?php print "</div>";
  } else if($price =='0'){
	 $src = $base_url.'/'.path_to_theme().'/images/subscribed_img.gif';
    print "<div class='add-to-cart'><img src='".$src."'/></div>";
  }
	
	?>
</td></tr>
<tr><td><hr>
	<span class="details_arrow" id="dt<?php echo $node->nid;?>">Details</span>
    <span class="right">Concepts / Day <input type="text" class="d_concepts" value="<?php echo $node->field_no_messages_per_day[0]['value'] ;?>" readonly="readonly"></span>
    <span class="right">Total Concepts <input type="text" class="t_concepts" value="<?php echo $node->field_total_messages[0]['value']?>" readonly="readonly"></span>
    <?php 
	if (variable_get('field_field_duration', TRUE)) {
	$totaldays = $node->field_duration[0]['value'];
$months = floor($totaldays / 30);
$days = $totaldays - $months*30;
$months = $months == 0 ? "":$months;
$months = $months == 1 ? $months." month ":$months;
$months = $months > 1 ? $months." months ":$months;
$days = $days > 0 ? $days." days":"";
$duration  = $months > 0?$months."".$days:$days;     
    }
	?>
    <span class="right">Duration <input type="text" class="du_concepts" value="<?php echo $duration ;?>" readonly="readonly"></span>
   <p style="clear: both; display:none;" id="dt<?php echo $node->nid;?>" class="details_desc">
    <span><?php echo $node->content['body']['#value'];?> </span>
   </p>
</td></tr></tbody>
</table>
</div>
